              package com.java.diagnostics.visualizer.impl.extensions;
              
              import com.java.diagnostics.visualizer.data.ids.ID;
              import java.util.HashSet;
              import java.util.Set;
              import org.eclipse.core.runtime.IConfigurationElement;
              import org.eclipse.core.runtime.IExtension;
              
              public abstract class DataIDRegistry extends GCAndMemoryVisualizerExtensionRegistry
              {
                private static final IExtension[] TEMPLATE_ARRAY = new IExtension[0];
              
                private static final IConfigurationElement[] ELEMENT_TEMPLATE_ARRAY = new IConfigurationElement[0];
                private static final String ID = "com.java.diagnostics.visualizer.defaultidtodisplay";
              
                protected String getExtensionPointID()
                {
                  return "com.java.diagnostics.visualizer.defaultidtodisplay";
                }
              
                public IExtension[] getExtensionsByTypeName(String typeName)
                {
                  IExtension[] extensions = super.getExtensions();
                  if (extensions != null) {
                    Set matches = new HashSet();
              
                    for (int i = 0; i < extensions.length; i++)
                    {
                      IExtension extension = extensions[i];
                      IConfigurationElement[] elements = extension
                        .getConfigurationElements();
              
                      for (int j = 0; j < elements.length; j++) {
                        IConfigurationElement element = elements[j];
              
                        String type = element.getName();
                        if ((type != null) && (type.equals(typeName))) {
                          matches.add(extension);
                        }
                      }
                    }
              
                    return (IExtension[])matches.toArray(TEMPLATE_ARRAY);
                  }
                  return null;
                }
              
                protected IConfigurationElement[] getElementsByTypeName()
                {
                  String typeName = getTypeName();
                  IExtension[] extensions = super.getExtensions();
                  Set matches = new HashSet();
                  if (extensions != null)
                  {
                    for (int i = 0; i < extensions.length; i++)
                    {
                      IExtension extension = extensions[i];
                      IConfigurationElement[] elements = extension
                        .getConfigurationElements();
              
                      for (int j = 0; j < elements.length; j++) {
                        IConfigurationElement element = elements[j];
              
                        String type = element.getName();
                        if ((type != null) && (type.equals(typeName))) {
                          matches.add(element);
                        }
                      }
                    }
                  }
              
                  return 
                    (IConfigurationElement[])matches
                    .toArray(ELEMENT_TEMPLATE_ARRAY);
                }
              
                public IExtension[] getExtensions()
                {
                  return getExtensionsByTypeName(getTypeName());
                }
              
                public Set getIDs()
                {
                  IConfigurationElement[] elements = getElementsByTypeName();
                  Set set = new HashSet();
                  for (int i = 0; i < elements.length; i++) {
                    IConfigurationElement element = elements[i];
                    String category = element.getAttribute("category");
                    String label = element.getAttribute("label");
                    ID id = instantiateID(category, label, element);
                    set.add(id);
                  }
                  return set;
                }
              
                protected abstract String getTypeName();
              
                protected abstract ID instantiateID(String paramString1, String paramString2, IConfigurationElement paramIConfigurationElement);
              }

